﻿/*
This file is under Microsoft Public License (MS-PL)
Copyright Yohann MARTEL.  All rights reserved.
Codeplex: http://amf.codeplex.com
AMF Website: http://www.ymartel.com/aspnet-mobile-framework/
*/
using System;
using System.ComponentModel;
using System.Web.UI;

namespace Mobile.WebControls
{
    public abstract class ThemedControl : BaseControl
    {
        #region Properties
        [Category("Appearance")]
        public DataTheme Theme { get; set; }
        #endregion

        #region Render Methods
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            if (Theme != DataTheme.None)
            {
                writer.AddAttribute(MetadataAttribute.DataTheme, Enum.GetName(typeof(DataTheme), Theme).ToLower());
            }

            
            if (!String.IsNullOrEmpty(ID))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID.Trim());
            }
        }
        #endregion
    }
}
